A method is known whereby the triangulation principle is used to measure the distance to a subject from two or more acquired (i.e., shot) images with parallax.
In this case, in order to solve for the parallax, it is typical to conduct template matching among a plurality of images. Template matching solves for parallax by scanning the template region from one image over another image, and searching for the position with the minimum amount of discrepancy.
Herein, when the subject and the background are largely separated in an acquired image, then occlusion occurs near the subject boundary, such that the two or more images appear different. In such cases, there is a problem in that the distance computational accuracy significantly decreases near the sites where occlusion occurs.
In order to resolve such problems, a technique has been proposed wherein, after conducting ordinary template matching, template matching is conducted using a small-size template at sites where distance variation in the images is large.
By reducing the template size in cases where the region compared by matching contains edges or greatly varying distances, this technique makes it possible to resolve the effects occlusion. However, although the accuracy of position matching is improved when the template size used in template matching is small, there is a problem in that the accuracy of distance computation decreases.
For example, when 3D modeling is to be conducted using acquired images of real-life objects, accurate modeling cannot be conducted if the distance computational accuracy is low. Consequently, the establishment of a technique is desired whereby distance computation in acquired images can be conducted with higher accuracy.